{extend name="index/base" /}
{block name="style"}
<style type="text/css">
	.layui-tab-content{padding: 0;}
</style>
{/block}
{block name="body" }
<div class="" style="padding: 10px;padding-top: 0;">  
  <div class="layui-row">
    <div class="layui-col-xs3" style="padding-right: 10px;">
      <table class="layui-table" lay-size="sm">
		  <thead>
		    <tr>
		      <th colspan="2">基本信息</th>
		    </tr> 
		  </thead>
		  <tbody>
		  	<tr><td>ID：</td><td>{$info.uid}</td></tr>
		    <tr><td>昵称：</td><td>{$info.nickname}</td></tr>
		    <tr><td>等级：</td><td>{$info.leval}</td></tr>
		    <tr><td>推荐码：</td><td>{$info.invite_code}</td></tr>
		    <tr><td rowspan="2">上级：</td><td><a href="javascript:;" class="show_userinfo" style="color:red;" data-title="【{$info.pid_nickname}】的用户信息" data-url="{:url('user.index/info',['id'=>$info.pid])}">{$info.pid}</a></td></tr>
		    <tr><td>{$info.pid_nickname}</td></tr>
		    <tr><td>手机：</td><td>{$info.mobile}</td></tr>
		    <tr><td>余额：</td><td>￥{$info.money}</td></tr>
		    <tr><td>经验值：</td><td>{$info.experience}</td></tr>
		    <tr><td>积分：</td><td>{$info.score}</td></tr>
		    <tr><td>城市：</td><td>{$info.province}{$info.city}</td></tr>
		    <tr><td>注册时间：</td><td>{$info.create_time|date="Y-m-d"}</td></tr>
		    <tr><td>登录时间：</td><td>{$info.last_time|date="Y-m-d"}</td></tr>
		    <tr><td>设备：</td><td>{$info.last_device_model}</td></tr>
		    <tr><td>状态：</td><td>{$info.status_text|raw}</td></tr>
		    <tr><td>最后升级时间：</td><td>{$info.last_leval_time|date="Y-m-d H:i:s"}</td></tr>
		    <tr><td>到期时间：</td><td>{eq name="info.leval_end_time" value="0"}永久{else/}{$info.leval_end_time|date="Y-m-d H:i:s"}{/eq}</td></tr>
		    <tr><td>冻结：</td><td><a class="layui-btn layui-btn-xs frozen" data-url="{:url('frozen',['ids'=>$info['uid']])}" >冻结</a></td></tr>
		  </tbody>
	</table>
    </div>
    <div class="layui-col-xs9" style="border-left: 1px solid #ddd;padding-left: 10px;">
         <div class="layui-tab layui-tab-brief" lay-filter="tab1">
		  <ul class="layui-tab-title">
		    <li class="layui-this">资金记录</li>
		    <li>推荐记录</li>
		    <li>提现记录</li>
		    <li>积分记录</li>
		  </ul>
		  <div class="layui-tab-content">
		  	<div class="layui-tab-item layui-show"><table id="tb1" lay-filter="_tb1"></table></div>
		    
		    <div class="layui-tab-item">
		    	<div class="" style="margin-top: 10px;">
	    			<form class="layui-form search" action="" style="" _lpchecked="1">
						<div class="layui-inline">
							<div class="layui-input-inline">
								<input type="number" name="ds" placeholder="代数" autocomplete="off" class="layui-input">
							</div>
						</div>
						 <div class="layui-inline">
						 	<div class="layui-input-inline">
						 		<button class="layui-btn layui-btn-sm sbtn" lay-submit="" lay-filter="searchsub" id="search"><i class="layui-icon"></i> 确定</button>
						 	</div>
						 </div>
					</form>
		    	</div>
		    	<table id="tb2" lay-filter="_tb2"></table>
		    </div>
		    <div class="layui-tab-item"><table id="tb3" lay-filter="_tb3"></table></div>
		    <div class="layui-tab-item"><table id="tb4" lay-filter="_tb4"></table></div>
		  </div>
		</div>  
    </div>
  </div>
</div>

{/block}

{block name="script"}
<script>
	layui.config({
		base: '/static/js/',
	});
	layui.use(['tool','element'], function() {
		var $ = layui.$,layer = layui.layer, form = layui.form,table = layui.table,tool = layui.tool,element = layui.element;
		tool.show_userinfo();
		var tableobj1 = table.render({
			elem:'#tb1',
			url:'{:url('info',['type'=>0,'id'=>$info['uid']])}',
			limit:10,
			limits:[10,15,20,50,100],
			page:true,
			size:'sm',
			method:'get',
			height:'full-120',
			cols:[[
				{'title':'类型',field:'type'},
				{'title':'变动金额',field:'money'},
				{'title':'变后余额',field:'blance'},
				{'title':'备注',field:'remark'},
				{'title':'attach',field:'attach'},
				{'title':'时间',field:'create_time'}
			]]
		});
		//监听Tab切换，以改变地址hash值
		element.on('tab(tab1)', function(data){
			if (data.index==1) {
				var tableobj3 = table.render({
					elem:'#tb2',
					url:'{:url('info',['type'=>1,'id'=>$info['uid']])}',
					limit:10,
					limits:[10,15,20,50,100],
					page:true,
					size:'sm',
					method:'get',
					height:'full-120',
					cols:[[
						{'title':'ID',field:'uid'},
						{'title':'昵称',field:'nickname'},
						{'title':'等级',field:'leval'},
						{'title':'设备',field:'last_device_model'},
						{'title':'时间',field:'create_time'}
					]]
				});
				//搜索
				form.on('submit(searchsub)',function(data){
					var fields = $(data.form).serialize();
					tableobj3.reload({
						where:data.field
						,page: {curr: 1 }
					});
					return false;
				})
			}else if (data.index==2) {
				var tableobj2 = table.render({
					elem:'#tb3',
					url:'{:url('info',['type'=>2,'id'=>$info['uid']])}',
					limit:10,
					limits:[10,15,20,50,100],
					page:true,
					size:'sm',
					method:'get',
					height:'full-120',
					cols:[[
						{'title':'UID',field:'uid'},
						{'title':'实际打款',field:'money'},
						{'title':'提现金额',field:'money_rel'},
						{'title':'状态',field:'status_text'},
						{'title':'时间',field:'create_time'}
					]]
				});
			}else if (data.index==3) {
				var tableobj3 = table.render({
					elem:'#tb4',
					url:'{:url('info',['type'=>3,'id'=>$info['uid']])}',
					limit:10,
					limits:[10,15,20,50,100],
					page:true,
					size:'sm',
					method:'get',
					height:'full-120',
					cols:[[
						{'title':'类型',field:'type'},
						{'title':'变动积分',field:'score'},
						{'title':'变后剩余',field:'blance'},
						{'title':'备注',field:'remark'},
						{'title':'attach',field:'attach'},
						{'title':'时间',field:'create_time'}
					]]
				});
			}
		});
		//冻结
		$(document).on('click','.frozen',function(){
			var that = this;
			layer.confirm('确认要冻结吗？', {
			  title:'提示'
			},function(){
				$.get($(that).data('url'),function(ret){
					if (ret.code==1) {
			    		layer.msg('操作成功',{icon:1});
			    		location.reload();
			    	}else{
			    		layer.msg(ret.msg||'异常~',{icon:2});
			    	}
				});
				
			});
		});


	});
</script>
{/block}
